<!-- TODO 新增家长信息 -->
<script id="form-parent-template" type="text/x-handlebars-template">
	<fieldset class="field-group"></fieldset>
	<form class="form-horizontal form-editor form-editor-parents form-editor-parents-{{index}}">
		<input type="hidden" name="status" id="parStatus" >
		<div class="row" data-dynamic-template>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label">关系</label>
					<div class="col-sm-8">
						<select name="relation" id="relation" class="chosen-select" data-url="/miwawa/default/common/select.json" data-pcode="c_parent_title" data-entity="com.app.miwawa.api.system.entity.config.Codec">
						</select>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label">姓名</label>
					<div class="col-sm-8">
						<input name="customerId" type="hidden" class="form-control" id="customerId">
						<input name="name" type="text" class="form-control" id="name">
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label required">手机</label>
					<div class="col-sm-8">
						<input name="mobile" id="mobile" type="text" class="form-control" required="required" onfocus="judge('.form-editor-parents-{{index}}')">
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label">APP昵称</label>
					<div class="col-sm-8">
						<input name="app" type="text" class="form-control">
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label">微信</label>
					<div class="col-sm-8">
						<input name="wechat" type="text" class="form-control">
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label">Email</label>
					<div class="col-sm-8">
						<input name="email" type="text" class="form-control">
					</div>
				</div>
			</div>
		</div>
		<div class="widget-footer editor-footer-sm">
			<button type="button" class="btn btn-danger btn-sm" title="取消" 
							data-toggle="tooltip" data-placement="top" 
							data-refresh-table="#table-allCustomer"
							onclick="handlerCancel(this);">
				<i class="glyphicon glyphicon-remove"></i>
			</button>
			<button type="button" class="btn btn-primary btn-sm" title="保存" 
							data-toggle="tooltip" data-placement="top" 
							onclick="holdup(this, '#editor-form-parents', '.form-editor-parents-{{index}}');" data-submit-callback="handlerParents">
				<i class="glyphicon glyphicon-ok"></i>
			</button>
		</div>
	</form>
</script>

<!-- TODO 新增宝宝信息 -->
<script id="form-student-template" type="text/x-handlebars-template">
	<fieldset class="field-group"></fieldset>
	<form class="form-horizontal form-editor form-editor-student-{{index}}">
		<div class="row" data-dynamic-template>
			<div class="col-sm-12">
				<div class="row">
					<div class="col-sm-4">
						<div class="form-group">
							<label class="col-sm-4 control-label required">姓名</label>
							<div class="col-sm-8">
								<input name="name" type="text" class="form-control" required="required">
							</div>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group">
							<label class="col-sm-4 control-label">昵称</label>
							<div class="col-sm-8">
								<input name="nick" type="text" class="form-control">
							</div>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group">
							<label class="col-sm-4 control-label">性别</label>
							<div class="col-sm-8">
								<select name="sex" id="sex" class="chosen-select form-control">
									<option value="男宝宝">男宝宝</option>
									<option value="女宝宝">女宝宝</option>
								</select>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-4">
						<div class="form-group">
							<label class="col-sm-4 control-label">生日</label>
							<div class="col-sm-8">
								<div class="input-group date date-controller">
									<input name="birthday" id="birthday" type="text" class="form-control"> 
									<span class="input-group-addon"> <span class="fa fa-calendar"></span> </span>
								</div>
							</div>
						</div>
					</div>
					<div class="col-sm-8">
						<div class="form-group">
							<label class="col-sm-2 control-label">备注</label>
							<div class="col-sm-10">
								<input name="remark" type="text" class="form-control" maxlength="30" placeholder="最多可填写30个字">
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="widget-footer editor-footer-sm editor-tools-student">
			<button type="button" class="btn btn-danger btn-sm" title="取消" 
							data-toggle="tooltip" data-placement="top" 
							data-refresh-table="#table-allCustomer"
							onclick="handlerCancel(this);">
				<i class="glyphicon glyphicon-remove"></i>
			</button>
			<button type="button" class="btn btn-primary btn-sm" title="保存"
							data-toggle="tooltip" data-placement="top"
							onclick="checkBirthday(this, '#editor-form-student', '.form-editor-student-{{index}}');" data-submit-callback="handlerStudent">
				<i class="glyphicon glyphicon-ok"></i>
			</button>
		</div>
	</form>
</script>

<!-- TODO 查看客户信息 -->
<script id="view-customer-template" type="text/x-handlebars-template">
	<form class="form-horizontal form-editor form-viewer-customer" data-entity="com.app.miwawa.api.esm.entity.customer.Customer">
		<input type="hidden" name="id" id="id" value="{{customerid}}"/>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label" for="code">客户编号</label>
					<div class="col-sm-8">
						<input name="code" id="code" type="text" class="form-control" readonly="readonly" value="{{code}}"> 
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label" for="createDate">加入时间</label>
					<div class="col-sm-8">
						<div class="input-group date date-controller" id="date-createDate">
							<input name="createDate" id="createDate" type="text" class="form-control" value="{{createDate}}" > 
							<span class="input-group-addon">
								<span class="fa fa-calendar"></span>
							</span>
						</div>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label" for="username">课程顾问</label>
					<div class="col-sm-8">
						<input name="username" id="username" type="text" class="form-control" readonly="readonly" value="{{username}}">
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label" for="market">市场渠道</label>
					<div class="col-sm-8">
						<select name="market" id="markets" class="chosen-select" data-url="/miwawa/default/common/select.json" data-pcode="c_market_type" data-entity="com.app.miwawa.api.system.entity.config.Codec">
							{{_market market}}
						</select>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label" for="source">信息来源</label>
					<div class="col-sm-8">
						<select name="source" id="sources" class="chosen-select" data-url="/miwawa/default/common/select.json"  data-pcode="c_source_type" data-entity="com.app.miwawa.api.system.entity.config.Codec">
							{{_source source}}
						</select>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-4 control-label" for="parentName">转介绍人</label>
					<div class="col-sm-8">
						<input name="parentName" id="parentName" type="text" class="form-control" value="{{parentName}}"> 
						<input name="parentId" type="hidden">
					</div>
				</div>
			</div>
		</div>
		<div class="widget-footer editor-footer-sm">
			<button type="button" class="btn btn-danger btn-sm" title="取消" 
				data-toggle="tooltip" data-placement="top" data-refresh-table="#table-allCustomer"
				onclick="handlerCancel(this, 'editor-wrapper-open');">
				<i class="glyphicon glyphicon-remove"></i>
			</button>
			<button type="button" class="btn btn-primary btn-sm" title="保存"
				data-toggle="tooltip" data-placement="top" 
				onclick="handlerSubmit(this, '#update-form-customer', '.form-viewer-customer');" >
				<i class="glyphicon glyphicon-ok"></i>
			</button>
		</div>

	</form>
</script>

<!-- TODO 查看家长信息 -->
<script id="view-parents-template" type="text/x-handlebars-template">
	{{#each this}}
		<fieldset class="field-group"></fieldset>
		<form name="editParents" class="form-horizontal form-editor form-editor-parents form-viewer-parents-{{@index}}" id="editParents" data-entity="com.app.miwawa.api.esm.entity.customer.Parents">
			<input type="hidden" name="id" id="parentid" value="{{id}}"/>
			<input type="hidden" name="status" value="{{status}}">
			<div class="row" data-dynamic-template>
				<div class="col-sm-4">
					<div class="form-group">
						<label class="col-sm-4 control-label">关系</label>
						<div class="col-sm-8">
							<select name="relation" id="relation-{{@index}}" class="chosen-select" data-url="/miwawa/default/common/select.json"  data-pcode="c_parent_title" data-entity="com.app.miwawa.api.system.entity.config.Codec">
								{{_relation relation @index}}
							</select>
						</div>
					</div>
				</div>
				<div class="col-sm-4">
					<div class="form-group">
						<label class="col-sm-4 control-label">姓名</label>
						<div class="col-sm-8">
							<input name="name" id="name" type="text" class="form-control" value="{{name}}"> 
						</div>
					</div>
				</div>
				<div class="col-sm-4">
					<div class="form-group">
						<label class="col-sm-4 control-label">手机</label>
						<div class="col-sm-8">
							<input name="mobile" id="mobile" type="text" class="form-control" value="{{mobile}}"> 
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-sm-4">
					<div class="form-group">
						<label class="col-sm-4 control-label">APP昵称</label>
						<div class="col-sm-8">
							<input name="app" id="app" type="text" class="form-control" value="{{app}}"> 
						</div>
					</div>
				</div>
				<div class="col-sm-4">
					<div class="form-group">
						<label class="col-sm-4 control-label">微信</label>
						<div class="col-sm-8">
							<input name="wechat" id="wechat" type="text" class="form-control" value="{{wechat}}"> 
						</div>
					</div>
				</div>
				<div class="col-sm-4">
					<div class="form-group">
						<label class="col-sm-4 control-label">Email</label>
						<div class="col-sm-8">
							<input name="email" id="email" type="text" class="form-control" value="{{email}}"> 
						</div>
					</div>
				</div>
			</div>
			<div class="widget-footer editor-footer-sm editor-tools-parents">
					<button type="button" class="btn btn-danger btn-sm" title="取消" data-toggle="tooltip" data-placement="top" 
								data-refresh-table="#table-allCustomer" onclick="handlerCancel(this);">
						<i class="glyphicon glyphicon-remove"></i>
					</button>
					<button type="button" class="btn btn-primary btn-sm" title="保存"
								data-toggle="tooltip" data-placement="top"
								onclick="changeMobile(this, '#update-form-parents', '.form-viewer-parents-{{@index}}');" data-submit-callback="handlerParents">
						<i class="glyphicon glyphicon-ok"></i>
					</button>
			</div>
		</form>
	{{/each}}
</script>

<!-- TODO 查看宝宝信息 -->
<script id="view-student-template" type="text/x-handlebars-template">
	{{#each this}}
		<fieldset class="field-group"></fieldset>
		<form class="form-horizontal form-editor form-viewer-student-{{@index}}" data-entity="com.app.miwawa.api.esm.entity.customer.Student">
			<input type="hidden" name="id" value="{{id}}"/>
			<div class="row" data-dynamic-template>
				<div class="col-sm-12">
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label">姓名</label>
								<div class="col-sm-8">
								<input name="name" id="name" type="text" class="form-control" value="{{name}}"> 
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label">昵称</label>
								<div class="col-sm-8">
								<input name="nick" id="nick" type="text" class="form-control" value="{{nick}}"> 
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label">性别</label>
								<div class="col-sm-8">
										<select name="sex" id="sex-{{@index}}" class="chosen-select" data-url="/miwawa/default/common/select.json"  data-pcode="c_student_sex" data-entity="com.app.miwawa.api.system.entity.config.Codec">
											{{_sex sex @index}}
										</select>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label">生日</label>
								<div class="col-sm-8">
									<div class="input-group date date-controller" id="date-birthday">
										<input name="birthday" id="birthday" type="text" class="form-control" value="{{birthday}}" > 
										<span class="input-group-addon">
											<span class="fa fa-calendar"></span>
										</span>
									</div>
								</div>
							</div>
						</div>
						<div class="col-sm-8">
							<div class="form-group">
								<label class="col-sm-2 control-label">备注</label>
								<div class="col-sm-10">
									<input name="remark" id="remark" type="text" class="form-control" maxlength="30" placeholder="最多可填写30个字" value="{{remark}}"> 
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="widget-footer editor-footer-sm editor-tools-student">
					<button type="button" class="btn btn-danger btn-sm" title="取消" data-toggle="tooltip" data-placement="top" 
								data-refresh-table="#table-allCustomer" onclick="handlerCancel(this);">
						<i class="glyphicon glyphicon-remove"></i>
					</button>
					<button type="button" class="btn btn-primary btn-sm" title="保存"
								data-toggle="tooltip" data-placement="top"
								onclick="checkBirthday(this, '#update-form-student', '.form-viewer-student-{{@index}}');" data-submit-callback="handlerStudent">
						<i class="glyphicon glyphicon-ok"></i>
					</button>
			</div>
		</form>
	{{/each}}
</script>

<!-- TODO 查看家庭地址 -->
<script id="view-address-template" type="text/x-handlebars-template">
	{{#each this}}
		<form class="form-horizontal form-editor form-editor-address-{{@index}}" data-entity="com.app.miwawa.api.esm.entity.customer.Address">
			<input type="hidden" name="id" value="{{id}}">
			<div class="row">
				<div class="col-sm-1">
					<div class="form-group">
						<label class="col-sm-12 control-label" for="province">地区</label>
					</div>
				</div>
				<div class="col-sm-2">
					<div class="form-group">
						<div class="col-sm-12">
							<div class="input-group">
								<select name="province" class="chosen-select" id="province">
									<option value="310000">上海</option>
								</select> 
								<span class="input-group-addon">省</span>
							</div>
						</div>
					</div>
				</div>
				<div class="col-sm-3">
					<div class="form-group">
						<div class="col-sm-12">
							<div class="input-group">
								<select name="prefecture" class="chosen-select" id="prefecture">
									<option value="310100">上海</option>
								</select> 
								<span class="input-group-addon">市</span>
							</div>
						</div>
					</div>
				</div>
				<div class="col-sm-3">
					<div class="form-group">
						<div class="col-sm-12">
							<div class="input-group">
								<select name="county" class="chosen-select" id="county">
									{{region county}}
								</select> 
								<span class="input-group-addon">区县</span>
							</div>
						</div>
					</div>
				</div>
				<div class="col-sm-3">
					<div class="form-group">
						<div class="col-sm-12">
							<div class="input-group">
								<span class="input-group-addon">邮编</span>
								<input name="zipcode" id="zipcode" type="text" class="form-control" value="{{zipcode}}">
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-sm-1">
					<div class="form-group">
						<label class="col-sm-12 control-label required" for="detail">地址</label>
					</div>
				</div>
				<div class="col-sm-8">
					<div class="form-group">
						<div class="col-sm-12">
							<input name="detail" id="detail" type="text" class="form-control" value="{{detail}}" required="required">
						</div>
					</div>
				</div>
				<div class="col-sm-3">
					<div class="form-group">
						<div class="col-sm-12">
							<div class="input-group">
								<span class="input-group-addon">电话</span>
								<input name="telephone" id="telephone" type="text" class="form-control" value="{{telephone}}">
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="widget-footer editor-footer-sm editor-tools-address">
				<button type="button" class="btn btn-danger btn-sm" title="取消" 
								data-toggle="tooltip" data-placement="top" 
								data-refresh-table="#table-allCustomer"
								onclick="handlerCancel(this);">
					<i class="glyphicon glyphicon-remove"></i>
				</button>
				<button type="button" class="btn btn-primary btn-sm" title="保存"
								data-toggle="tooltip" data-placement="top"
								onclick="handlerSubmit(this, '#editor-form-address', '.form-editor-address-{{@index}}');" data-submit-callback="handlerAddress">
					<i class="glyphicon glyphicon-ok"></i>
				</button>
			</div>
		</form>
	{{/each}}
</script>